//
//  PYMineHeadCell.m
//  IHome
//
//  Created by zhujizheng on 2020/2/15.
//  Copyright © 2019年 com.zhujizheng. All rights reserved.
//

#import "PYMineHeadCell.h"

@interface PYMineHeadCell ()
/// 用户头像
@property (nonatomic, strong) UIImageView *headImgView;
/// 用户昵称
@property (nonatomic, strong) UILabel *nickLabel;
/// 个性签名
@property (nonatomic, strong) UILabel *signLabel;
@end

@implementation PYMineHeadCell

+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    PYMineHeadCell *cell = [tableView dequeueReusableCellWithIdentifier:@"headCellid"];
    if (!cell) {
        cell = [[self alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"headCellid"];
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        [cell initHeadImgView];
        [cell initNickLabel];
        [cell initSignLabel];
    }
    return cell;
}

#pragma mark - headImgView
- (UIImageView *)headImgView
{
    if (!_headImgView) {
        _headImgView = [UIImageView new];
        _headImgView.layer.cornerRadius = 5;
        _headImgView.layer.masksToBounds = YES;
        _headImgView.backgroundColor = PY_APP_ImageView_backgroundColor;
        _headImgView.contentMode = UIViewContentModeScaleAspectFill;
        _headImgView.image = [[UIImage imageNamed:@"defaultIcon"] imageWithColor:PY_Medium_Color];
    }
    return _headImgView;
}

- (void)initHeadImgView
{
    [self.contentView addSubview:self.headImgView];
    [self.headImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(24);
        make.centerY.mas_equalTo(self);
        make.size.mas_equalTo(CGSizeMake(64, 64));
    }];
}

#pragma mark - nickLabel
- (UILabel *)nickLabel
{
    if (!_nickLabel) {
        _nickLabel = [UILabel new];
        _nickLabel.font = PY_Font_Bold(21);
        _nickLabel.textColor = PY_Dark_Color;
        _nickLabel.text = @"角色好友";
    }
    return _nickLabel;
}

- (void)initNickLabel
{
    [self.contentView addSubview:self.nickLabel];
    [self.nickLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.headImgView.mas_right).mas_offset(17);
        make.top.mas_equalTo(self.headImgView);
        make.right.mas_equalTo(-30);
        make.height.mas_equalTo(40);
    }];
}

#pragma mark - signLabel
- (UILabel *)signLabel
{
    if (!_signLabel) {
        _signLabel = [UILabel new];
        _signLabel.font = PY_Font_Light(17);
        _signLabel.textColor = PY_Medium_Color;
        _signLabel.text = @"点击查看非角色好友界面";
        _signLabel.numberOfLines = 0;
    }
    return _signLabel;
}

- (void)initSignLabel
{
    [self.contentView addSubview:self.signLabel];
    [self.signLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.nickLabel);
        make.top.mas_equalTo(self.nickLabel.mas_bottom);
        make.right.mas_equalTo(self.nickLabel);
        make.height.mas_equalTo(24);
    }];
}

@end
